#include "vlmodebar.h"
#include "GUIDebug.h"

VLModeBar::VLModeBar(QWidget *parent) :
    QToolBar(tr("Mode Bar"), parent)
{
    currentMode = tr("Create");
    modeLabel = new QLabel(tr("Create"), this);
    this->addWidget(modeLabel);

    this->addSeparator();

    createModeBtn = new VLModeButton(tr("Create"), "Create", this);
    this->addWidget(createModeBtn);

    gameModeBtn = new VLModeButton(tr("Game"), "Game", this);
    this->addWidget(gameModeBtn);

    connect(createModeBtn, SIGNAL(clicked(QString)), this, SLOT(setMode(QString)));
    connect(gameModeBtn, SIGNAL(clicked(QString)), this, SLOT(setMode(QString)));
}

void VLModeBar::setMode(QString mode) {
    if (currentMode.compare(mode) != 0) {
        currentMode = mode;
        modeLabel->setText(mode);
        emit modeChanged(mode);
    }
}
